<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* empty认为空格也是有内容 */
        .box{
            width: 300px;
            height: 150px;
            border: 1px solid #000;
            position: relative;
            left: 100px;
            top: 100px;
        }
        .inner{
            height: 30px;
            width: 30px;
            line-height: 30px;
            text-align: center;
            border-radius: 50%;
            background-color: red;
            color: white;
            font-size: 20px;
            position: absolute;
            right: -15px;
            top: -15px;
            display: none;
        }
        /* inner不是空的 显示 */
        .inner:not(:empty){
            display: block;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="inner">1</div>
    </div>
</body>
</html>